# -*- mode: makefile-gmake; mode: flyspell-prog; -*-

# mspdebug arguments:
#
#   mspdebug [MSP_TTY=<mspdebug-tty-device>]

PROGRAM = mspdebug-tty

MSP_DEBUG ?= mspdebug

ifeq ($(MSPDEBUG_DRIVER),)
  ifeq ($(MSP_TTY),)
     MSP_TTY=/dev/cu.ez430f2013
  endif
  MSPDEBUG_DRIVER=uif -d $(MSP_TTY)
endif

program: $(BSL_TARGETS) $(TELOS_PROGRAM_DEPS) FORCE
	@echo "    installing $(PLATFORM) binary using mspdebug $(MSPDEBUG_DRIVER)"
	$(MSP_DEBUG) $(MSP_DEBUG_FLAGS) $(MSPDEBUG_DRIVER) "prog $(INSTALL_IHEX)"
	rm -f $(subst .ihex.,.exe.,$(INSTALL_IHEX)) $(INSTALL_IHEX) 

program_bl: $(BSL_TARGETS) $(TELOS_PROGRAM_DEPS) FORCE
	@echo "    installing $(PLATFORM) bootloader using mspdebug $(MSPDEBUG_DRIVER)"
	$(MSP_DEBUG) $(MSP_DEBUG_FLAGS) $(MSPDEBUG_DRIVER) "prog $(BOOTLOADER_IMG)"

program_input: ihex
	@:

# vim: set noet ts=8 sw=8 syntax=make:
